package com.lx.oms.controller.service.impl;

import java.math.BigInteger;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.lx.oms.common.entity.Page;
import com.lx.oms.common.entity.Query;
import com.lx.oms.common.entity.R;
import com.lx.oms.common.utils.CommonUtils;
import com.lx.oms.controller.entity.UserEnterpriseEntity;
import com.lx.oms.controller.manager.UserEnterpriseManager;
import com.lx.oms.controller.service.UserEnterpriseService;

/**
 * 企业
 *
 * @author houzhong
 * @date 2018年7月10日 下午3:11:42
 */
@Service("userEnterpriseService")
public class UserEnterpriseServiceImpl implements UserEnterpriseService {

	@Autowired
	private UserEnterpriseManager userEnterpriseManager;

	@Override
	public Page<UserEnterpriseEntity> listUserEnterprise(Map<String, Object> params) {
		Query query = new Query(params);
		Page<UserEnterpriseEntity> page = new Page<>(query);
		userEnterpriseManager.listUserEnterprise(page, query);
		return page;
	}

	@Override
	public R saveUserEnterprise(UserEnterpriseEntity role) {
		int count = userEnterpriseManager.saveUserEnterprise(role);
		return CommonUtils.msg(count);
	}

	@Override
	public R getUserEnterpriseById(BigInteger id) {
		UserEnterpriseEntity userEnterprise = userEnterpriseManager.getUserEnterpriseById(id);
		return CommonUtils.msg(userEnterprise);
	}

	@Override
	public R updateUserEnterprise(UserEnterpriseEntity userEnterprise) {
		int count = userEnterpriseManager.updateUserEnterprise(userEnterprise);
		return CommonUtils.msg(count);
	}

	@Override
	public R batchRemove(String[] id) {
		int count = userEnterpriseManager.batchRemove(id);
		return CommonUtils.msg(id, count);
	}

}
